import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

// 编程式跳转使用this.$router.push()
export default new Router({
    routes: [{
            path: '/',
            name: 'index',
            redirect: '/mainPage'
        },
        {
            path: '/mainPage',
            name: '1',
            component: (resolve) => {
                require(['@/components/mainPage/mainPage'], resolve)
            },
            meta: {
                title: '报表页面'
            },
            children: [
                {
                    name: 'orderHistory',
                    path: 'orderHistory',
                    component: (resolve) => {
                        require(['@/components/mainPage/pages/orderHistory/orderHistory'], resolve)
                    },
                    meta: {
                        title: '历史订单'
                    }
                },
                {
                    name: 'payHistory',
                    path: 'payHistory',
                    component: (resolve) => {
                        require(['@/components/mainPage/pages/orderHistory/payHistory'], resolve)
                    },
                    meta: {
                        title: '历史支付单'
                    }
                },
				{
					name: 'Invoice',
					path: 'Invoice',
					component: (resolve) => {
					    require(['@/components/mainPage/pages/orderHistory/Invoice'], resolve)
					},
					meta: {
					    title: '开票'
					}
				},
				{
					name: 'InvoiceInfo',
					path: 'InvoiceInfo',
					component: (resolve) => {
					    require(['@/components/mainPage/pages/orderHistory/InvoiceInfo'], resolve)
					},
					meta: {
					    title: '开票信息'
					}
				},
				{
					name: 'addedServices',
					path: 'addedServices',
					component: (resolve) => {
					    require(['@/components/mainPage/pages/addedServices/addedServices'], resolve)
					},
					meta: {
					    title: '增值服务'
					}
				},
				{
					name: 'adminAddedServices',
					path: 'adminAddedServices',
					component: (resolve) => {
					    require(['@/components/mainPage/pages/admin/adminAddedServices'], resolve)
					},
					meta: {
					    title: '增值服务'
					}
				},
				{
					name: 'adminUserOrder',
					path: 'adminUserOrder',
					component: (resolve) => {
					    require(['@/components/mainPage/pages/admin/adminUserOrder'], resolve)
					},
					meta: {
					    title: '商家应用'
					}
				},
				{
					name: 'adminSetAnnualFee',
					path: 'adminSetAnnualFee',
					component: (resolve) => {
					    require(['@/components/mainPage/pages/admin/adminSetAnnualFee'], resolve)
					},
					meta: {
					    title: '配置年费'
					}
				},
				{
					name: 'shopping',
					path: 'shopping',
					component: (resolve) => {
					    require(['@/components/mainPage/pages/addedServices/shopping'], resolve)
					},
					meta: {
					    title: '增值服务商城'
					}
				},
				{
					name: 'schemeSetting',
					path: 'schemeSetting',
					component: (resolve) => {
					    require(['@/components/mainPage/pages/orderHistory/schemeSetting'], resolve)
					},
					meta: {
					    title: '方案设置'
					}
				},
				{
                    name: 'userOrder',
					path: 'userOrder',
					component: (resolve) => {
					    require(['@/components/mainPage/pages/orderHistory/userOrder'], resolve)
					},
					meta: {
					    title: '我的应用'
					}
				},
				{
                    name: 'setAnnualFee',
					path: 'setAnnualFee',
					component: (resolve) => {
					    require(['@/components/mainPage/pages/orderHistory/setAnnualFee'], resolve)
					},
					meta: {
					    title: '配置年费'
					}
				}
            ]
        },
        {
            path: '/login',
            name: '2',
            component: (resolve) => {
                require(['@/components/account/login'], resolve)
            },
            meta: {
                title: '商家登录'
            }
        }
    ],
    // 定义激活路由的样式
    linkActiveClass: 'active',
    base: '/addService/'
})
